package com.jbm.enterapplication.utlisclass

import android.app.Activity
import java.util.*

/**
 * Created by 家帮忙 on 2017/9/4.
 */
class ExitActivity {

    private constructor()

    companion object{
        fun getInstanst():ExitActivity{
            return MyExitActivity.EXITACTIVITY
        }

        internal object  MyExitActivity{

          internal  var EXITACTIVITY=ExitActivity()


        }


    }

    internal var ListActivity: MutableList<Activity> = ArrayList()
    //添加每个Activity
    fun addActivity(activity: Activity) {
        ListActivity.add(activity)
    }

    //销毁时调用
    fun deActivity(activity: Activity) {
        ListActivity.remove(activity)
    }


    //退出时调用
    fun exitActivity() {
        for (activity in ListActivity) {
            activity.finish()
        }
        // System.exit(0);
    }

    fun exitActivitys() {
        for (activity in ListActivity) {
            activity.finish()
        }
        System.exit(0)
    }


}